import  CryptoJS from "crypto-js";


const key = CryptoJS.enc.Utf8.parse('FaceSunAweSome_K');
const iv = CryptoJS.enc.Utf8.parse('FaceSunAweSomeIV');
export const AES_Encrypt = (pass) => {
  const password = CryptoJS.enc.Utf8.parse(pass);
  return CryptoJS.AES.encrypt(password, key, {
    mode: CryptoJS.mode.CBC,
    iv: iv,
    padding: CryptoJS.pad.Pkcs7
  }).toString();
}
 
/**
 * AES 解密
 * @param jsonStr
 */
export const AES_Decrypt = (pass) => {
  return CryptoJS.AES.decrypt(pass, key, {
    mode: CryptoJS.mode.CBC,
    iv: iv,
    padding: CryptoJS.pad.Pkcs7
  }).toString(CryptoJS.enc.Utf8);

}
